<template>
    <div class="footer">
        <div class="opction">
            <dl class="home">
                <dt class="icon1">
                    <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/home_details@2x.png">
                </dt>
                <dd class="homeTest">首页</dd>
            </dl>

            <dl class="message">
                <dt class="icon2">
                    <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/customer_service@2x.png">
                </dt>
                <dd class="mess">客服</dd>
            </dl>
            <dl class="collection">
                <dt class="icon3" @click="">
                    <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/nocollection_details@2x.png">
                </dt>
                <dd class="love">收藏</dd>
            </dl>
        </div>
        <div class="btn" @click="btnUp">
            <ul >
                <li class="money">¥111</li>
                <li class="buy" >直接购买 </li>
            </ul>
        </div>
         <mt-popup v-model="popupVisible" position="bottom" class="alert">
                <div class="buy">
                    <div class="one">
                        <div class="photo">
                            <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/Product/T1.jpg">
                        </div>
                        <ul class="doing">
                            <li class="icon">¥25</li>
                            <li class="text">已选:精选5斤装&nbsp;单果约200g</li>
                        </ul>
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/close_details@2x.png" style="width:.65rem;height:.65rem;border-radius:50%;float:right; margin-right:.28rem;margin-top:.28rem;">
                    </div>

                    <div class="two">
                        <h1>重量</h1><br>
                        <ul class="format" >
                        <!--<li :class="{ change:changeRed == index}" @click="reds(index)">精选5斤装</li>-->
                            <li>精选8斤装</li>
                            <li>精选10斤装</li>
                            <li>精选15斤装</li>
                        </ul>
                    </div>

                    <div class="two">
                        <p>尺寸</p>
                        <ul class="format">
                            <li>精选5斤装</li>
                            <li>精选8斤装</li>
                        </ul>
                    </div>
                    <div class="four">
                        <p class="shopNum">购买数量</p>
                        <ul class="meth">
                            <li class="detele">-</li>
                            <li class="number">0</li>
                            <li class="add">+</li>
                        </ul>                      
                    </div>
                </div>

                <div class="sure" @click="goCut">
                    确定
                </div>
        </mt-popup>
        <button class="btn-right" @click="goCut">
            砍到底价
        </button>

    </div>
</template>

<script>
    import config from "../config/config.js";
    import { Popup } from 'mint-ui';
    export default {
            data() {
                return {
                    popupVisible: false,
                    changeRed:0
                }
            },
            props:{
                skuList:[],
            },
            components: {
                Popup
            },
            beforeUpdate:function(){
                function cloneObj(from) {
                    return Object.keys(from)
                        .reduce((obj, key) => (obj[key] = clone(from[key]), obj), {});
                }
                function cloneArr(from) {
                    return from.map((n) => clone(n));
                }
                function clone(from) {
                    if (from instanceof Array) {
                        return cloneArr(from);
                    } else if (from instanceof Object) {
                        return cloneObj(from);
                    } else {
                        return (from);
                    }
                }
                const obj = this.skuList;
                const obj2=clone(obj);
                console.log(obj2);
             /*   var priceArr=[];
                for(var i in obj2){
                    if(obj2[i]["pro_peice"]!=='undefined'){
                        priceArr.concat(obj2[i]["pro_peice"])
                    }
                }
                this.minPrice=priceArr.min();
                console.log(1);
                console.log(this.minPrice);*/
            },
            methods: {
                btnUp() {
                    this.popupVisible = true
                },
              /*  reds:function(index){
                    this.changeRed = index;
                },*/
                goCut(){
                   /*
                    this.$router.push('/threekan/'+skuid)*/

                    var value=JSON.stringify({"sku_id":skuId,"token":localStorage.getItem('token')}),
                        key=demo(value);
                    axios.post('/Home/cut/PushCut',{
                            value:value,
                            key:key
                    },config)
                        .then(function(response) {
                            console.log(response);
                        }.bind(this))
                        .catch(function (error) {
                            console.log(error);
                        });
                },
            },
            mounted(){
                console.log(1)
            }
        }
</script>

<style>
</style>